﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EIIS.Infrastructure.Model.System.Authority;
using EIIS.Infrastructure.Service;
using EIIS.Infrastructure.Service.System.Authority;
using EIIS.Infrastructure.Repositories.System.Authority;

namespace EIIS.Infrastructure.Service.Implement
{
    public class HospUserManager:GenericManagerBase<HospUser>,IHospUserManager
    {
        public bool UpdatePasswordByName(string strLoginName, string strNewPassword)
        {
            return ((IHospUserRepository)this.CurrentRepository).UpdatePasswordByName(strLoginName, strNewPassword);
        }

        public bool UpdatePasswordByID(string strId, string strNewPassword)
        {
            return ((IHospUserRepository)this.CurrentRepository).UpdatePasswordByID(strId, strNewPassword);
        }

        public HospUser GetUserByName(string strLoginName)
        {
            return ((IHospUserRepository)this.CurrentRepository).GetUserByName(strLoginName);
        }

        public bool ValidateByName(string strLoginName, string strPassword)
        {
            return ((IHospUserRepository)this.CurrentRepository).ValidateByName(strLoginName,strPassword);
        }

        public bool ValidateByID(string strId, string strPassword)
        {
            return ((IHospUserRepository)this.CurrentRepository).ValidateByID(strId,strPassword);
        }

        public bool IsExistWithLoginName(string strLoginName, string strId, string strWhere)
        {
            return this.IsFieldExist("LoginName", strLoginName, strId, strWhere);
        }

        public bool IsExistWithName(string strUserName, string strId, string strWhere)
        {
            return this.IsFieldExist("Name", strUserName, strId, strWhere);
        }

        public bool IsExistWithCode(string strCode, string strId, string strWhere)
        {
            return this.IsFieldExist("Code", strCode, strId, strWhere);
        }

        public IList<HospUser> LoadAllWithPage(out long total, int page, int rows, string order, string sort)
        {
            return ((IHospUserRepository)this.CurrentRepository).LoadAllWithPage(out total, page, rows, order, sort).ToList();
        }
    }
}
